<div class="row">
	<div class="col-xs-12 col-md-12">
		<div class="widget">
			<div class="widget-header bg-blue">
				<i class="widget-icon fa fa-arrow-down"></i>
				<span class="widget-caption">审核列表</span>
				<div class="widget-buttons">
					<a href="#" data-toggle="maximize">
						<i class="fa fa-expand"></i>
					</a>
					<a href="#" data-toggle="collapse">
						<i class="fa fa-minus"></i>
					</a>
					<a href="#" data-toggle="dispose">
						<i class="fa fa-times"></i>
					</a>
				</div>
			</div>
			<div class="widget-body">
				<div class="table-toolbar">
					<div class="pull-left">
						
						<a id="confirmAll" class="btn btn-primary">全部批准</a>
						<a id="refuseAll" class="btn btn-danger">全部否决</a>
					</div>
					<div class="pull-right">
						<form id="Joel-search">
							<label><input type="text" class="input-sm" id="startdate" name="startdate" placeholder="搜索开始时间" value="{$Think.request.startdate}" /> ~ <input type="text" class="input-sm" id="enddate" name="enddate" placeholder="搜索结束时间" value="{$Think.request.enddate}" /></label>
							<label><select name="stype" class="form-control input-sm"><option value='1' <eq name='stype' value='1'>selected</eq>>按代理商昵称【模糊】</option><option value='2' <eq name='stype' value='2'>selected</eq>>按房间号</option></select></label>
							<label><input name="search" type="search" class="form-control input-sm" placeholder="请输入搜索条件" value="{$Think.request.search}"></label>
							<a href="{:U('Cms/Jxrooms/index/')}" class="btn btn-success" data-loader="Joel-loader" data-loadername="审核列表" data-search="Joel-search">
								<i class="fa fa-search"></i>搜索
							</a>
						</form>
					</div>
				</div>

				<table id="Joel-table" class="table table-bordered table-hover">
					<thead class="bordered-darkorange">
						<tr role="row">
							<th width="20px"><div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
									<label style="padding-left: 4px;"> <input type="checkbox" class="Joel-checkall colored-blue">
                                     <span class="text"></span>
									</label>                                    
                                </div></th>
							<th>代理商昵称</th>
							<th>房间号码</th>							
							<th>创建时间</th>
							<th>状态</th>
							<th>操作</th>
						</tr>
						</tr>
					</thead>
					<tbody>
						<volist name="cache" id="vo">
							<tr id="item{$vo.id}">
								<td>
									<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
										<label style="padding-left: 4px;"> <input name="checkvalue" type="checkbox" class="colored-blue Joel-check" value="{$vo.id}">
	                                     <span class="text"></span>
										</label>                                    
	                                </div>
								</td>
								<td class=" sorting_1">{$vo.nickname}</td>
								<td class=" ">{$vo.roomid}</td>
								<td class=" ">{$vo.game_create_time}</td>
								<td class=" "><if condition="$vo.jx_status eq 0">未审核<elseif condition="$vo.jx_status eq -1" /><font style="color:red">已否决</font></if></td>
								<td class="center ">
								<if condition="$vo.jx_status eq 0">
									<button class="btn btn-primary btn-xs vipup" data-id = "{$vo.id}"><i class="glyphicon glyphicon-ok"></i> 批准</button>
									&nbsp;&nbsp;<button class="btn btn-danger btn-xs vipdown" data-id = "{$vo.id}"><i class="glyphicon glyphicon-refresh"></i> 否决</button>
								<elseif condition="$vo.jx_status eq -1" />
									<button class="btn btn-primary btn-xs vipup" data-id = "{$vo.id}"><i class="glyphicon glyphicon-ok"></i> 批准</button>
								</if>
							</tr>
						</volist>
												
					</tbody>
				</table>
				<div class="row DTTTFooter">
					{$page}
				</div>
			</div>
		</div>
	</div>
</div>
<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>
<!--/面包屑导航封装-->
<!--全选特效封装/全部删除-->
<script type="text/javascript">
	//全选
	var checkall=$('#Joel-table .Joel-checkall');
	var checks=$('#Joel-table .Joel-check');
	var trs=$('#Joel-table tbody tr');
	$(checkall).on('click',function(){
		if($(this).is(":checked")){			
			$(checks).prop("checked","checked");
		}else{
			$(checks).removeAttr("checked");
		}		
	});
	$(trs).on('click',function(){
		var c=$(this).find("input[type=checkbox]");
		if($(c).is(":checked")){
			$(c).removeAttr("checked");
		}else{
			$(c).prop("checked","checked");
		}		
	});
	$('#confirmAll').on('click',function(){
		var checks=$(".Joel-check:checked");
		var chk='';
		$(checks).each(function(){
			chk+=$(this).val()+',';
		});
		if(!chk){
			$.Joel.alert('danger','请选择要审核的对象！');
			return false;
		}
		var toajax="{:U('Cms/Jxrooms/setjxstatus')}"+"/status/1"+"/id/"+chk.substring(0,chk.length-1);
		var callok=function(){
			//主框架可以直接模拟点击刷新按钮
			//$('#refresh-toggler').trigger('click');
			$(JoelLoaderReloader).trigger('click');
			return false;
		};
		var callerr=function(){
			//拦截错误
			return false;
		};
		$.Joel.ajax('post',toajax,'nodata',callok,callerr);
	});
	
	$('#refuseAll').on('click',function(){
		var checks=$(".Joel-check:checked");
		var chk='';
		$(checks).each(function(){
			chk+=$(this).val()+',';
		});
		if(!chk){
			$.Joel.alert('danger','请选择要否决的对象！');
			return false;
		}
		var toajax="{:U('Cms/Jxrooms/setjxstatus')}"+"/status/-1"+"/id/"+chk.substring(0,chk.length-1);
		var callok=function(){
			//主框架可以直接模拟点击刷新按钮
			//$('#refresh-toggler').trigger('click');
			$(JoelLoaderReloader).trigger('click');
			return false;
		};
		var callerr=function(){
			//拦截错误
			return false;
		};
		$.Joel.ajax('post',toajax,'nodata',callok,callerr);
	});
	
	var vipup=$('.vipup');
	$(vipup).on('click',function(){
			var id=$(this).data('id');
			$.ajax({
					type:"post",
					url:"{:U('Cms/Jxrooms/setjxstatus')}",
					data:{'id':id,'status':1},
					dataType: "json",
					//beforeSend:$.Joel.loading(),
					success:function(mb){
						//$.Joel.loading();
						$.Joel.alert(mb.status=='1'?'success':'danger',mb.msg);
						$(JoelLoaderReloader).trigger('click');				
					},
					error:function(xhr){
						$.Joel.alert('danger','通讯失败！请重试！');
					}
			});
		return false;
	});
	
	var vipdown=$('.vipdown');
	$(vipdown).on('click',function(){
			var id=$(this).data('id');
			$.ajax({
					type:"post",
					url:"{:U('Cms/Jxrooms/setjxstatus')}",
					data:{'id':id,'status':-1},
					dataType: "json",
					//beforeSend:$.Joel.loading(),
					success:function(mb){
						//$.Joel.loading();
						$.Joel.alert(mb.status=='1'?'success':'danger',mb.msg);	
						$(JoelLoaderReloader).trigger('click');					
					},
					error:function(xhr){
						$.Joel.alert('danger','通讯失败！请重试！');
					}
			});
		return false;
	});
	
	$('#startdate').datepicker({
            format: "yyyy-mm-dd"
        });
    $('#enddate').datepicker({
            format: "yyyy-mm-dd"
        });
	
</script>
<!--/全选特效封装-->